<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:79:"D:\www\photo_album_bless\public_html/../application/admin\view\article\add.html";i:1546393808;s:68:"D:\www\photo_album_bless\application\admin\view\lib\common_list.html";i:1546393808;}*/ ?>
<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:16:41 GMT -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <title></title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="stylesheet" href="/static/plugins/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/sys/css/style.min.css">
    <link rel="stylesheet" href="/static/plugins/bootstrap-table/bootstrap-table.css">
    <!--<link rel="stylesheet" href="/static/plugins/dataTables/dataTables.bootstrap.css">-->
    <link rel="stylesheet" href="/static/plugins/layer/skin/layer.css">
    <link rel="stylesheet" href="/static/plugins/layer/skin/layer.ext.css">
    <link rel="stylesheet" href="/static/plugins/layer/laydate/need/laydate.css">
    <link rel="stylesheet" href="/static/plugins/layer/laydate/skins/default/laydate.css">
    
    <script src="/static/plugins/jquery-1.12.4/jquery-1.12.4.min.js"></script>
    <script src="/static/plugins/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="/static/plugins/layer/layer.min.js"></script>
    <script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/static/plugins/layer/laydate/laydate.js"></script>

    <style>
        .text-red{color:red;}
        .text-green{color:#17bb46;}
        .text-orange{color:orange;}
        .text-yellow{color:#c7cd2f;}
        .text-blue{color:#0bb8c8;}
        .fixed-table-toolbar .bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top:-45px;}
        .th-inner{color:#555;}
    </style>
    
<link rel="stylesheet" type="text/css" href="/static/sys/css/common.css" />
<link rel="stylesheet" type="text/css" href="/static/plugins/select2/css/select2.css" />
<link rel="stylesheet" type="text/css" href="/static/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css" />

<link rel="stylesheet" type="text/css" href="/static/sys/css/skin_0.css" />
<style>
    .upfile i{padding-right:3px !important;}
    .file{ position:absolute;right:0;top:0;width:100px;height:100px;opacity:0; ilter:alpha(opacity=0);cursor:pointer;margin-bottom: 0px;margin-right: 0px; }
</style>

</head>

<body class="gray-bg">
    
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form method="post" id="fmNew" class="form-horizontal" enctype="multipart/form-data">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">美文标题：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="title" placeholder="美文标题">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">美文类别：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="cate_name" id="cate_name" onchange="categoryValue()">
                                    <option>请选择分类.....</option>
                                    <?php if(is_array($category_list) || $category_list instanceof \think\Collection || $category_list instanceof \think\Paginator): $i = 0; $__LIST__ = $category_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $v['name']; ?>" cate_id="<?php echo $v['id']; ?>"><?php echo $v['name']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">美文跳转按钮：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="button_name" id="button_name" onchange="buttonValue()">
                                    <option>请选择跳转按钮....</option>
                                    <?php if(is_array($button_list) || $button_list instanceof \think\Collection || $button_list instanceof \think\Paginator): $i = 0; $__LIST__ = $button_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $v['name']; ?>" button_key="<?php echo $v['key']; ?>"><?php echo $v['name']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分享次数：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" name="share" placeholder="分享次数">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">点击次数：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" name="click" placeholder="点击次数">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" name="sort" placeholder="越小越靠前">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">状态：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="status">
                                    <?php if(is_array($status_list) || $status_list instanceof \think\Collection || $status_list instanceof \think\Paginator): $i = 0; $__LIST__ = $status_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $key; ?>"><?php echo $v; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">音乐|视频：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="status">
                                    <?php if(is_array($type_list) || $type_list instanceof \think\Collection || $type_list instanceof \think\Paginator): $i = 0; $__LIST__ = $type_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $key; ?>"><?php echo $v; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">背景音乐：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="mp3_url" placeholder="背景音乐url">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">背景图：</label>

                            <div class="col-sm-1">
                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="backgroundImg()">
                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 背景图<input type="hidden" name="background_url" id="background_url" />
                                </span>
                            </div>
                            <div class="col-sm-1">
                                <img id="previewImg_background" style="height:34px;float: right;">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">音乐歌词：</label>
                            <div class="col-sm-8">
                                <textarea class="form-control" name="mp3_url" placeholder="歌词" cols="100%" rows="3"></textarea>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">封面图：</label>

                            <div class="col-sm-1">
                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="coverImg()">
                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 封面图<input type="hidden" name="cover_img_url" id="cover_img_url" />
                                </span>
                            </div>
                            <div class="col-sm-1">
                                <img id="previewImg_cover" style="height:34px;float: right;">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分享标题：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="share_title" placeholder="分享标题">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分享封面图：</label>

                            <div class="col-sm-1">
                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="shareImg()">
                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 分享封面图<input type="hidden" name="share_img_url" id="share_img_url" />
                                </span>
                            </div>
                            <div class="col-sm-1">
                                <img id="previewImg_share" style="height:34px;float: right;">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">美文来源：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="from_url" placeholder="美文来源">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">美文内容:</label>
                            <div class="col-sm-16">
                                <div style='display: inline-block; vertical-align: middle;'>
                                    <!-- 加载编辑器的容器 -->
                                    <script id="content" name="content" type="text/plain">
                                    </script>
                                    <!-- 配置文件 -->
                                    <script type="text/javascript" src="/static/plugins/ueditor/ueditor.config.js"></script>
                                    <!-- 编辑器源码文件 -->
                                    <script type="text/javascript" src="/static/plugins/ueditor/ueditor.all.js"></script>
                                    <!-- 实例化编辑器 -->
                                    <script type="text/javascript">
                                        var ue = UE.getEditor('content');
                                    </script>
                                </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div id = 'hidden_input'>
                            <input type="hidden" id="button_key" name="button_key"/>
                            <input type="hidden"  name="cate_id" id = "cate_id"/>
                        </div>

                        <div id="dg" style="z-index: 9999; position: fixed ! important; right: 50%; top:90%;">
                            <div class="form-group">
                                <div class="col-sm-12 col-sm-offset-5" >
                                    <button class="btn btn-primary" id="ok" type="button">提交</button>
                                    <button class="btn btn-white" id="cancel" type="button">取消</button>
                                </div>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
    
<script type="text/javascript" src="/static/plugins/select2/js/select2.js"></script>
<script type="text/javascript" src="/static/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/static/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

<script>
    $(document).ready(function () {
        $("#ok").bind("click", Save);
        $("#cancel").bind("click", function () {
            parent.layer.close(parent.layer_add_index);
        });

        /**
         * 保存内容
         */
        function Save() {
            var load_index = layer.load(0, { shade: false });

            $.ajax({
                type: 'POST',
                url: "<?php echo url('article/add'); ?>",
                data: $("#fmNew").serialize(),
                dataType: 'json',
                success: function (data) {
                    if (data.code == 1) {
                        layer.close(load_index);
                        layer.alert(data.msg, function () {
                            parent.refreshtb();
                            //window.close();
                            parent.layer.close(parent.layer_add_index);
                        });
                    } else {
                        layer.alert(data.msg);
                    }
                }
            })
        }

        $('#cate_name').select2();
        $('#button_name').select2();
    });

    /**
     * 新增图片
     */
    var layer_image_add;
    function coverImg() {
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=cover_img"
        })
    }
    function shareImg() {
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=share_img"
        })
    }

    function backgroundImg() {
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=background_img"
        })
    }

    // 上传成功后的回调，该函数名不能写错
    function getImageUrl(res) {
        if (res.tag == 'cover_img') {
            $('#cover_img_url').val(res.url);
            $('#previewImg_cover').attr('src', res.url);
        } else if (res.tag == 'share_img') {
            $('#share_img_url').val(res.url);
            $('#previewImg_share').attr('src', res.url);
        } else if (res.tag == 'background_img') {
            $('#background_url').val(res.url);
            $('#previewImg_background').attr('src', res.url);
        }
    }

    function categoryValue() {
        var cate_id = $("#cate_name").children('option:selected').attr('cate_id');
        $('#cate_id').val(cate_id);
    }

    function buttonValue() {
        var button_key = $("#button_name").children('option:selected').attr('button_key');
        $('#button_key').val(button_key);
    }

</script>

<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:17:11 GMT -->
</html>
